package com.app.micaihu.custom.view;

import android.text.TextPaint;
import android.text.style.ClickableSpan;
import android.view.View;

import com.app.micaihu.R;
import com.app.micaihu.app.AppApplication;

/**
 * Created by Guo on 2016/9/12.
 *
 *
 * textview中部分文字的点击实现类
 *
 *
 * 传点击的listener；和   颜色
 */
public class TextViewClickable extends ClickableSpan {


    private final View.OnClickListener mListener;
    private int resId;

    public TextViewClickable(View.OnClickListener l,int resId) {
        this.mListener = l;
        this.resId = resId;
    }

    @Override
    public void onClick(View widget) {
        mListener.onClick(widget);
    }

    @Override
    public void updateDrawState(TextPaint ds) {

        //ds.setColor(getResources().getColor(R.color.common_font_color_7));
        ds.setColor(AppApplication.getInstance().getResources().getColor(resId));
    }
}
